import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import app from './modules/app'
import settings from './modules/settings'
import user from './modules/user'

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    app,
    settings,
    user
  },
  getters
})

export default store

// import Vue from 'vue'
// import Vuex from 'vuex'
// import getters from './getters'

// Vue.use(Vuex)
// // 下面代码（从const req  到 mName.forEach ）可以省略导入vuex 模块文件
// const req = require.context('./modules', false, /\.js$/)
// const mName = req.keys().map(item=>{ return item.split('./')[1]}).map(item=>{return item.split('.js')[0]})
// const mModule = req.keys().map(req)

// const obj = {}

// mName.forEach((key,index)=>{
//   console.log('key',key);
//   console.log('index',index);
//   obj[key] = mModule[index].default

// });
// console.log('obj',obj);

// const store = new Vuex.Store({
//   modules: obj,
//   getters
// })

// export default store
